// QueryManager.h
#include "DBReader.h"
#include "DBWriter.h"

#pragma once

using namespace System;

class QueryManager
{
private:
	static QueryManager *instance;
	DBReader dbreader;
	DBWriter dbwriter;
private:
	QueryManager ();
public:
	static QueryManager *get_instance ();

	// DBReader methods
	void LoadFlightNums (int, int *, int *, int);
	void LoadFlightNums (int, int, int, int *, int *, int);
	void LoadFlight (int, double *, int, int, int);
	void LoadFlight (int, double *, int, int, int, int, int);
	void LoadFlightSubsystem(int, int, double *, int, int, int, int, int);

	void LoadVectorsNums (int, int *, int, int *, int *);
	void LoadVectorsNums (int, double, int *, int *);
	void LoadSubsystemsVectorsNums(int, int,  double, int *, int *);
	void LoadClusterVectorsNums (int, double, int *, int *, char *, int);
	void LoadVectors (int, double *, int *, int, int, int);
	void LoadVectors (int, double *, double, int, int);
	void LoadSubsystemsVectors(int, int, double*, double, int, int);
	void LoadClusterVectors (int, double *, double, int, int, char *, int);

	void GetFlightIDsNum (int, int *);
	void GetFlightIDs (int, double *, int);
	
	void GetClusteredFlightIDsNum (char *, int *);
	void GetClusteredFlightIDs (char *, double *, int);

	void LoadClusteringNums (int, int *, int *, char *);
	void LoadClustering (int, double *, double *, int, int, char *);
	void LoadClusteringNums (int, int *, int *, int *, char *);
	void LoadClustering (int, double *, double *, double *, int, int, int, char *);

	void LoadMetricRealizationNum (char *, char *, int *);
	void LoadMetricRealizationNum (int, int *);
	void LoadMetricRealizationNum (int, int *, int *);
	void LoadMetricRealization (char *, char *, double *, char *[], int);
	void LoadMetricRealization (int, char *, double *, char *, int);
	void LoadMetricRealization (int, char *, double *, char *, int, double *, int);
	void GetEvaluatedFlightIDsNum (int, int *);
	void GetEvaluatedFlightIDs (int, double *, int);

	void LoadMetricTypesNum (int, int, int *);
	void LoadMetricTypes (int, int, double *, char *[], int);
	void LoadMetricNum (int, int, int, int *);
	void LoadMetric (int, int, int, double *, int);

	void LoadProblems (int, double *, int);

	void LoadFlightVectorsNums (int, double, int *, int *);
	void LoadFlightVectors (int, double *, double, int, int);

	int GetClustersNum (char *);

	void GetClusteringRunDate (int, char *);

	void GetParameterIDsNum (int, int *);
	void GetParameterIDs (int, double *, int);

	void LoadParameterNum (int, int, int *);
	void LoadParameter (int, double *, int, int);

	// DBWriter methods
	void SaveClusters (int *, int, char *, int, char *, char *, double **, double *, int);
	void SaveClusters (int *, int, char *, int, char *, char *, double **, double *, int, double *, int);
	void UpdateClusters (int *, int, int, char *, double **, double *, int);
	void UpdateClusters (int *, int, int, char *, double **, double *, int, double *, int);
	int SaveMetricRealization (char *, char *, double *, int, char *);
	int SaveMetricRealization (char *, char *, double *, int, double *, int, char *);
	int UpdateMetricRealization (int, double *, int);
	int UpdateMetricRealization (int, double *, int, double *, int);
	int SaveMetric (int, int, double *, char *, int);
	int InsertNewFlight(char* , char* , char* , char* , int*);
	void RegisterVectors (int, int, int);
	void SaveXMLBlank (int, int, char *);
};
